from flask import Flask, request, jsonify
from werkzeug.exceptions import HTTPException
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/api/data', methods=['GET'])
def get_data():
    if 'name' in request.args:
        name = request.args.get('name')
        return jsonify({'message': f'Hello, {name}!'})
    else:
        raise HTTPException(status_code=400, detail='Name is required.')

@app.route('/')
def hello_world():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run(debug=True )
